package com.csu.backmanagesys.Exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

/**
 * controller增强器
 */
@ControllerAdvice
public class GlobalExceptionHandler{
    //全局异常捕捉
    @ExceptionHandler
    public ModelAndView globalException(Exception ex){

        ModelAndView modelAndView = new ModelAndView();
        modelAndView.setViewName("/error/error");

        System.out.println("error");

        return modelAndView;
    }
}

